package logic

import (
	"2301_dockers/model"
	"context"

	"2301_dockers/dockersrpc/dockersrpc"
	"2301_dockers/dockersrpc/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type DockerListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewDockerListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DockerListLogic {
	return &DockerListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *DockerListLogic) DockerList(in *dockersrpc.DockerListRequest) (*dockersrpc.DockerListResponse, error) {
	// todo: add your logic here and delete this line
	var docker model.Docker
	model.DB.Debug().Where("id=?", in.Id).Find(&docker)
	return &dockersrpc.DockerListResponse{
		Name:             docker.Name,
		AffiliatedCampus: docker.AffiliatedCampus,
		Department:       docker.Department,
		Price:            float32(docker.Price),
		Professionals:    docker.Professionals,
		Label:            docker.Label,
		Diagnosis:        float32(docker.Diagnosis),
		Desc:             docker.Desc,
		Img:              docker.Img,
	}, nil
}
